#include<linux/module.h>
#include<linux/sched.h>
#include<linux/pid.h>
#include<linux/kthread.h>
MODULE_LICENSE("GPL");
int my_function(void *argc)
{
	printk("in the kernel thread function\n");
	printk("the my_function pid is:%d\n",current->pid);
	printk("out the kernel thread function\n");
	return 0;
}
static int __init yield_init(void)
{
	struct task_struct *result;
	char namefrm[]="yield.c";
	printk("into yield_init.\n");
	result=kthread_create_on_node(my_function,NULL,-1,namefrm);
	wake_up_process(result);
	yield();
	printk("the pid of new thread is:%d\n",result->pid);
	printk("the current pid is:%d\n",current->pid);
	printk("out yield_init.\n");
	return 0;
}
static void __exit yield_exit(void)
{
	printk("<0>Goodbye yield\n");
}
module_init(yield_init);
module_exit(yield_exit);
